<!--
- @founder   IT柏拉图, https: //weibo.com/itprato
- @author    DedeCMS团队
- @copyright Copyright (c) 2007 - 2021, 上海卓卓网络科技有限公司 (DesDev, Inc.)
--->

<html>
<head>
<meta charset="{dede:global.cfg_soft_lang/}" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>新建采集节点</title>
<meta name="copyright" content="2007-2021 DedeCMS, 上海卓卓网络科技有限公司 (DesDev, Inc.)" />
<link rel="icon" href="/favicon.ico" />
<!-- CSS FILES -->
<link rel="stylesheet" type="text/css" href="{dede:global.cfg_assets_dir/}/pkg/uikit/css/uikit.min.css" />
<link rel="stylesheet" type="text/css" href="{dede:global.cfg_assets_dir/}/css/manage.dede.css">
<style type="text/css">
.uk-table td{
padding: 6px 12px;
vertical-align: top;
height: 35px;
}
</style>
</head>
<body>
<!-- 列表头部 -->
<div id="Table_Header_202X2W2X1X292F" class="uk-card uk-card-small uk-card-default" uk-sticky="bottom: #offset">
<div id="Header_1W2T2S2T1V252B" class="uk-card-header">
<div class="uk-grid uk-grid-small uk-text-small">
<span><ul class="uk-breadcrumb"><li><a href="co_main.php">采集节点管理</a></li><li><span>新建采集节点</span></li><li><span>设置内容字段获取规则</span></li></span>
</div>
</div>
</div>
<!-- /列表头部 -->
<!-- 列表主体 -->
<div class="uk-card uk-card-small uk-card-default" style="top:-20px;margin-bottom: 50px;">
<div class="uk-card-body uk-overflow-auto" grid>
<div class="uk-child-width-1-1 uk-padding">
<table width="98%" border="0" cellpadding="1" cellspacing="1" class="uk-table">
<form name="form1" method="post" action="co_add.php">
<input type='hidden' name='nid' value='<?php echo $nid; ?>' />
<input type='hidden' name='channelid' value='<?php echo $channelid; ?>' />
<input type='hidden' name='step' value='5' />
<!-- 选项 -->
<tr>
<td width="15%">预览网址：</td>
<td><input type="text" class="uk-input uk-form-small uk-form-width-large" name="previewurl" id="previewurl" value="<?php echo $previewurl; ?>" /></td>
</tr>
<tr>
<td height="60">内容分页导航所在的区域匹配规则：</td>
<td>
<textarea class="uk-textarea uk-form-small uk-form-width-large" name="sppage" rows="3" id="sppage"></textarea><br/><br/>
<input name="sptype" type="radio" value="full" class="uk-radio" checked='1' />
全部列出的分页列表 &nbsp;&nbsp;
<input type="radio" name="sptype" class="uk-radio" value="next" />
上下页形式或不完整的分页列表 &nbsp;&nbsp;
<input type="radio" name="sptype" class="uk-radio" value="diyrule"/>
分页列表规则 开始:
<input name="srul" type="text" class="uk-input uk-form-small uk-form-width-small" value="1"/>
结束:
<input name="erul" type="text" class="uk-input uk-form-small uk-form-width-small" value="5"/>
</td>
</tr>
<tr>
<td>关键字过滤内容：</td>
<td>
<textarea class="uk-textarea uk-form-small uk-form-width-large" name="keywordtrim" rows="4" id="keywordtrim"></textarea>
</td>
</tr>
<tr>
<td>摘要过滤内容：</td>
<td>
<textarea class="uk-textarea uk-form-small uk-form-width-large" name="descriptiontrim" rows="4" id="descriptiontrim"></textarea>
</td>
</tr>
<tr>
<td><input type='checkbox' class="uk-checkbox" name='fields[]' value='title' /> <b>文章标题</b></td>
<td></td>
</tr>
<tr>
<td>匹配规则：</td>
<td>
<textarea class="uk-textarea uk-form-small uk-form-width-large" name="match_title" rows="4" id="match_title"><title>[内容]</title></textarea>
</td>
</tr>
<tr>
<td>过滤规则：</td>
<td><textarea class="uk-textarea uk-form-small uk-form-width-large" name="trim_title" cols="20" rows="3" id="trim_title"></textarea> </td>
</tr>
<tr>
<td><input type='checkbox' class="uk-checkbox" name='fields[]' value='writer' /> <b>文章作者</b></td>
<td></td>
</tr>
<tr>
<td>匹配规则：</td>
<td><textarea class="uk-textarea uk-form-small uk-form-width-large" name="match_writer" rows="4" id="match_writer"></textarea>
</td>
</tr>
<tr>
<td>过滤规则：</td>
<td><textarea class="uk-textarea uk-form-small uk-form-width-large" name="trim_writer" cols="20" rows="3" id="trim_writer"></textarea>
</td>
</tr>
<tr>
<td><input type='checkbox' class="uk-checkbox" name='fields[]' value='source' /> <b>文章来源</b></td>
<td></td>
</tr>
<tr>
<td>匹配规则：</td>
<td><textarea class="uk-textarea uk-form-small uk-form-width-large" name="match_source" rows="4" id="match_source"></textarea>
</td>
</tr>
<tr>
<td>过滤规则：</td>
<td><textarea class="uk-textarea uk-form-small uk-form-width-large" name="trim_source" cols="20" rows="3" id="trim_source"></textarea>
</td>
</tr>
<tr>
<td><input type='checkbox' class="uk-checkbox" name='fields[]' value='pubdate' /> <b>发布时间</b></td>
<td></td>
</tr>
<tr>
<td>匹配规则：</td>
<td><textarea class="uk-textarea uk-form-small uk-form-width-large" name="match_pubdate" rows="4" id="match_pubdate"></textarea>
</td>
</tr>
<tr>
<td>过滤规则：</td>
<td>
<textarea class="uk-textarea uk-form-small uk-form-width-large" name="trim_pubdate" cols="20" rows="3" id="trim_pubdate"></textarea>
<input name="function_pubdate" type="hidden" id="function_pubdate" value="@me=strtotime(@me);" />
</td>
</tr>
<?php
$row = $dsql->GetOne("Select * From `#@__channeltype` where id='$channelid' ");
$dtp = new DedeTagParse();
$dtp->SetNameSpace('field','<','>');
$dtp->LoadString($row['fieldset']);
foreach($dtp->CTags as $ctag)
{
//采集禁用的字段
$notsend = $ctag->GetAtt('notsend');
if($notsend==1) continue;
$fieldtype = $ctag->GetAtt('type');
$tname = $ctag->GetTagName();
$iname = $ctag->GetAtt('itemname');
//设置转换函数
if($fieldtype=='img') $functions = "@me=TurnImageTag(@me);";
else if($fieldtype=='softlinks'||$fieldtype=='addon') $functions = "@me=TurnLinkTag(@me);";
else if($fieldtype=='dtime') $functions = "@me=strtotime(@me);";
else $functions = '';
//对不同类型设置默认值
if($ctag->GetAtt('default')!='') {
$dfvalue = $ctag->GetAtt('default');
}
else if($fieldtype=='int'||$fieldtype=='float'||$fieldtype=='number') {
$dfvalue = '0';
}
else if($fieldtype=='dtime') {
$dfvalue = time();
}
else {
$dfvalue = '';
}
?>
<tr>
<td><input type='checkbox' class="uk-checkbox" name='fields[]' value='pubdate' /> <b><?php echo $iname; ?></b></td>
<td></td>
</tr>
<tr>
<td width="10%" class="adline">字段默认值：</td>
<td class="adline">
<input name="value_<?php echo $tname; ?>" type="text" class="uk-input uk-form-small uk-form-width-large" id="value_<?php echo $tname; ?>" value="<?php echo $dfvalue; ?>" />
</td>
</tr>
<tr>
<td width="16%">匹配规则：</td>
<td>
<textarea class="uk-textarea uk-form-small uk-form-width-large" name="match_<?php echo $tname; ?>" rows="4" id="match_<?php echo $tname; ?>"></textarea><br/><br/>
<?php
if($fieldtype=='htmltext' || $fieldtype=='img')
{
?>
<input name="isunit_<?php echo $tname; ?>" type="checkbox" id="isunit_<?php echo $tname; ?>" value="1" class="np" checked='checked' />
分页内容字段（规则中只允许单一的该类型字段）<br/>
<input name="isdown_<?php echo $tname; ?>" type="checkbox" id="isdown_<?php echo $tname; ?>" value="1" class="np" checked='checked' />
下载字段里的多媒体资源
<?php
}
?>
</td>
</tr>
<tr>
<td>过滤规则：</td>
<td>
<textarea class="uk-textarea uk-form-small uk-form-width-large" name="trim_<?php echo $tname; ?>" cols="20" rows="3" id="trim_<?php echo $tname; ?>"></textarea>
</td>
</tr>
<tr>
<td height="60">自定义处理接口：</td>
<td width="52%">
<textarea class="uk-textarea uk-form-small uk-form-width-large" name="function_<?php echo $tname; ?>" cols="20" rows="3" id="function_<?php echo $tname; ?>"><?php echo $functions;?></textarea><br/>
函数或程序的变量
@body 表示原始网页 @litpic 缩略图
@me 表示当前标记值和最终结果
</td>
</tr>
<?php } ?>
<!-- /选项 -->
</table>
</div>
</div>
<div class="uk-card-footer " >
<div class="uk-padding-small" >
<button type="submit" class="uk-button uk-button-small uk-button-primary">下一步</button>
</div>
</div>
</div>
</form>
<!-- 列表底部 -->
<div class="bar-bottom uk-flex uk-light uk-flex-right">
<div class="uk-button-group" style="margin-left: 50px;">
</div>
<div class="e1e02">Copyright &copy; 2007-2021 <a href='http://www.dedecms.com' target='_blank'><u>DedeCMS</u></a>, 上海卓卓网络科技有限公司 (DesDev, Inc.)</div>
</div>
<!-- 列表底部 -->
<!-- JS FILES -->
<script src="{dede:global.cfg_assets_dir/}/pkg/uikit/js/uikit.min.js"></script>
<script src="{dede:global.cfg_assets_dir/}/pkg/uikit/js/uikit-icons.min.js"></script>
<script src="{dede:global.cfg_assets_dir/}/pkg/jquery/jquery.min.js"></script>
<script src="{dede:global.cfg_assets_dir/}/js/dede.manage.min.js"></script>
<!-- / JS FILES -->
</body>
</html>
